<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:r="http://ricchieri.com/facelets"
	xmlns:p="http://primefaces.org/ui">
<h:head>
</h:head>
<h:body>
	<ui:composition template="../../templates/commonLayoutOther.xhtml">
		<ui:define name="title">#{msg.titleOther}</ui:define>
		<ui:define name="content">
			<h:form id="searchCharterForm">
				<p:messages showDetail="false" autoUpdate="true" closable="false" />
				<h2>#{msg.searchExpenses}</h2>
				<h:panelGrid columns="2">
					<h:outputLabel value="#{msg.charterExpenseNumber}" />
					<p:inputText id="charterExpenseNumber"
						value="#{searchCharterExpenseMB.charterExpenseFilter.charterNumber}"
						onkeypress="if(event.which &lt; 48 || event.which &gt; 57) return false;"
						maxlength="3" />

					<h:outputLabel value="#{msg.charterExpenseType}" />
					<p:selectOneMenu id="charterType"
						value="#{searchCharterExpenseMB.charterExpenseFilter.charterExpenseType}">
						<f:selectItem itemLabel="#{msg.defaultComboValue}" itemValue="" />
						<f:selectItems
							value="#{searchCharterExpenseMB.charterExpensivesTypes}" />
					</p:selectOneMenu>
					
					<h:outputLabel value="#{msg.from}" />
					<p:calendar pattern="dd/MM/yyyy" showOn="button"
						readOnlyInputText="true"
						value="#{searchCharterExpenseMB.charterExpenseFilter.start}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
					</p:calendar>
					
					<h:outputLabel value="#{msg.to}" />
					<p:calendar pattern="dd/MM/yyyy" showOn="button"
						readOnlyInputText="true"
						value="#{searchCharterExpenseMB.charterExpenseFilter.finish}">
						<f:convertDateTime pattern="dd/MM/yyyy" timeZone="GMT-3" />
					</p:calendar>

				</h:panelGrid>
				<h:panelGrid columns="2" style="margin-top:10px; text-align:center">
					<r:commandLinkCustom id="reset" action="#{searchCharterExpenseMB}"
						method="reset" icon="icon-eraser" message="#{msg.resetButton}" />
					<r:commandLinkCustom id="search" action="#{searchCharterExpenseMB}"
						method="search" icon="icon-search" message="#{msg.searchButton}" />
				</h:panelGrid>

				<p:blockUI block="charterExpenseTable" trigger="charterExpenseTable">  
			        #{msg.loading}<br />
					<p:graphicImage value="/images/ajax-loader.gif" />
				</p:blockUI>

				<p:dataTable var="charterExpenses"
					value="#{searchCharterExpenseMB.charterExpenseLazyDataModel}"
					paginatorPosition="bottom" id="charterExpenseTable"
					paginator="true" rows="10" lazy="true"
					emptyMessage="#{msg.noRecordsFound}"
					style="padding-top:15px;width:100%">

					<p:column headerText="#{msg.charterNumber}" style="width:15%">
						<h:outputText value="#{charterExpenses.charter.charterNumber}" />
					</p:column>

					<p:column headerText="#{msg.charterExpenseDate}" style="width:30%">
						<h:outputText
							value="#{searchCharterExpenseMB.formatDate(charterExpenses.date)}" />
					</p:column>

					<p:column headerText="#{msg.charterExpenseType}" style="width:30%">
						<h:outputText
							value="#{searchCharterExpenseMB.obtainDescription(charterExpenses.charterExpenseType.description)}" />
					</p:column>

					<p:column headerText="#{msg.charterExpenseAmount}"
						style="width:30%">
						<h:outputText value="#{charterExpenses.amount}" />
					</p:column>

					<p:column headerText="#{msg.actions}" style="width:40%">
						<center>
							<h:commandLink
								action="#{searchCharterExpenseMB.viewCharterExpense(charterExpenses)}"
								ajax="false" process="@form">
								<i class="icon-zoom-in icon-2x color-zoom"></i>
							</h:commandLink>
							<r:space /><r:space />
							
							<h:commandLink action="#{searchCharterExpenseMB.editCharterExpense(charterExpenses)}">
	        					<i class="icon-edit icon-2x color-edit"></i>
	        				</h:commandLink>
							<r:space/><r:space/>
							
							<p:commandLink oncomplete="deleteCharterExpense.show();"
									action="#{searchCharterExpenseMB.showDialog(charterExpenses)}">
								<i class="icon-remove-sign icon-2x color-delete"></i>
	        				</p:commandLink>
	        				<r:space/><r:space/>
						</center>
					</p:column>
				</p:dataTable>

				<p:confirmDialog id="confirmDialogDel"
					message="#{msg.deleteMessage}" header="#{msg.deleteProcessHeader}"
					severity="alert" widgetVar="deleteCharterExpense">
					<center>
						<p:commandButton id="confirmdelete" value="#{msg.yesMessage}"
							oncomplete="deleteCharterExpense.hide()"
							action="#{searchCharterExpenseMB.delete()}" update="@form"
							partialSubmit="true" process="@form" />
						<p:commandButton id="declinedelete" value="#{msg.noMessage}"
							oncomplete="deleteCharterExpense.hide()"
							action="#{searchCharterExpenseMB.unselect()}" />
					</center>
				</p:confirmDialog>
			</h:form>
		</ui:define>
	</ui:composition>
</h:body>
</html>
